"""
    @Author  ：思念 
    @File    ：3.多标签定位.py
    @Date    ：2025/4/9 11:03 
"""
from DrissionPage import ChromiumPage

page = ChromiumPage()
page.get('https://movie.douban.com/top250')
div_list = page.eles("xpath://ol[@class='grid_view']/li/div[@class='item']")

for item in div_list:
    item_dict = dict()
    movie_name = item.ele('xpath:./div[@class="info"]/div[@class="hd"]//span[1]').text

    movie_image = item.ele('xpath:./div[@class="pic"]/a').attr('href')
    """
    attr: 获取指定的属性值
    attrs: 获取当前标签中的所有属性与值, 返回的数据类型为字典
    详情: https://www.drissionpage.cn/SessionPage/get_ele_info/#%EF%B8%8F%EF%B8%8F-attrs
    """
    movie_attr = item.ele('xpath:./div[@class="pic"]/a').attrs

    print(movie_name, movie_image,movie_attr)

page.quit()
